import { Spin } from 'antd';
import { LoadingOutlined } from '@ant-design/icons';
import type { SpinProps } from 'antd';
import './loading.scss';
interface LoadingProps extends SpinProps {
    fullScreen?: boolean;
    tip?: string;
    size?: 'small' | 'default' | 'large';
}

const antIcon = <LoadingOutlined style={{ fontSize: 24 }} spin />;

export const Loading: React.FC<LoadingProps> = ({
    fullScreen = false,
    tip = '加载中...',
    size = 'large',
    className = '',
    ...restProps
}) => {
    const fullScreenStyle: React.CSSProperties = fullScreen ? {} : {};

    return (
        <div className={`loading-container ${className}`} style={fullScreenStyle}>
            <Spin indicator={antIcon} tip={tip} size={size} {...restProps} />
        </div>
    );
};

// 默认导出
export default Loading;
